package cn.xiaobai;

import cn.xiaobai.utils.SourceUtils;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;
import java.nio.file.Paths;

public class MainApplication extends Application {

    private static URL path;

    static {
        String loginView = "Login-view";
        path = SourceUtils.getFxmlSource(loginView);
    }


    @Override
    public void start(Stage stage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(path);
//        Scene scene = new Scene(fxmlLoader.load(), 320, 240); // 限定了初始大小, 所以导致无论配置怎么修改大小都无效
        Scene scene = new Scene(fxmlLoader.load());
        stage.setTitle("Hello!");
        stage.setResizable(false); // 取消最大化
//        stage.initStyle(StageStyle.UTILITY); // 同时取消最大,小化
        stage.setScene(scene);
        stage.centerOnScreen(); // 中心屏幕
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }
}